//
//  YSY_HeroVideo_TableViewCell.m
//  GoodManNews
//
//  Created by dllo on 16/1/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "YSY_HeroVideo_TableViewCell.h"

@implementation YSY_HeroVideo_TableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    //图片
    self.videoImageV = [UIImageView new];
    [self.contentView addSubview:self.videoImageV];
//    self.videoImageV.backgroundColor = [UIColor greenColor];
    //总时间
    self.videoTotalTimeL = [UILabel new];
    self.videoTotalTimeL.textAlignment = NSTextAlignmentRight;
    [self.videoImageV addSubview:self.videoTotalTimeL];
//    self.videoTotalTimeL.backgroundColor = [UIColor redColor];
    
   
    //标题
    self.videoTitleL = [UILabel  new];
    self.videoTitleL.numberOfLines = 2;
//    self.videoTitleL.textAlignment = nst
    [self.contentView addSubview:self.videoTitleL];
    self.videoTitleL.backgroundColor = [UIColor clearColor];
    self.videoTitleL.textColor = [UIColor whiteColor];
    
    //发布时间
    self.videoTimeL  = [UILabel  new];

    [self.contentView addSubview:self.videoTimeL];
//    self.videoTimeL.backgroundColor = [UIColor yellowColor];
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    [self.videoImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).with.offset(PAD);
        make.top.equalTo(self.contentView).with.offset(PAD);
        make.bottom.equalTo(self.contentView).with.offset(-PAD * 4);
        make.right.equalTo(self.contentView).with.offset(-PAD);
    }];
    
    
    [self.videoTitleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).with.offset(PAD);
        make.top.equalTo(self.contentView).with.offset(PAD);
        make.right.equalTo(self.contentView).with.offset(-PAD);
        make.height.mas_equalTo(self.contentView.bounds.size.height / 2);
        
    }];
    
    [self.videoTimeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).with.offset(PAD);
        make.top.equalTo(self.videoImageV.mas_bottom);
        make.right.equalTo(self.videoTotalTimeL.mas_left);
        make.bottom.equalTo(self.contentView).with.offset(-PAD);
        make.width.equalTo(self.videoTotalTimeL);
    }];
    
    [self.videoTotalTimeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.videoTimeL.mas_right);
        make.top.equalTo(self.videoImageV.mas_bottom);
        make.bottom.equalTo(self.contentView).with.offset(-PAD);
        make.right.equalTo(self.contentView).with.offset(-PAD);
        make.width.equalTo(self.videoTimeL);
//        make.width.mas_equalTo(self.contentView.bounds.size.width / 3);
    }];
}
@end
